package com.yz.api.facade.bi;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yz.model.vo.bi.ChartVo;
import com.yz.common.resp.BaseResponse;
import com.yz.model.dto.chart.ChartAddRequest;
import com.yz.model.dto.chart.ChartQueryRequest;
import com.yz.model.dto.chart.ChartUpdateRequest;
import com.yz.model.dto.chart.GenChartByAiRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:
 * <p>
 * User:Mr.Du
 * Date:2024/4/10
 * Time:10:56
 */
@Tag(name = "Bi接口")
public interface BiFacade {

    @Operation(summary = "创建图表")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/bi/add")
    BaseResponse<Long> addChart(@RequestHeader Long uid, @RequestBody ChartAddRequest chartAddRequest);

    @Operation(summary = "智能分析")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/bi/gen")
    BaseResponse<ChartVo> genChartByAi(@RequestHeader Long uid, @RequestPart("file") MultipartFile multipartFile,
                                       GenChartByAiRequest genChartByAiRequest);

    @Operation(summary = "智能分析(异步)")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/bi/gen/async")
    BaseResponse<ChartVo> genChartByAiAsync(@RequestHeader Long uid, @RequestPart("file") MultipartFile multipartFile,
                                            GenChartByAiRequest genChartByAiRequest);

    @Operation(summary = "智能分析(异步消息队列)")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/bi/gen/async/mq")
    BaseResponse<ChartVo> genChartByAiAsyncMq(@RequestHeader Long uid, @RequestPart("file") MultipartFile multipartFile,
                                              GenChartByAiRequest genChartByAiRequest);

    @Operation(summary = "删除图表")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER),
            @Parameter(name = "id", description = "图表id", in = ParameterIn.PATH)})
    @DeleteMapping("/bi/delete")
    BaseResponse<Boolean> deleteChart(@RequestHeader Long uid, @PathVariable Long id);

    @Operation(summary = "更新图表")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/bi/update")
    BaseResponse<Boolean> updateChart(@RequestHeader Long uid, @RequestBody ChartUpdateRequest chartUpdateRequest);

    @Operation(summary = "分页获取列表")
    @PostMapping("/bi/list/page")
    BaseResponse<Page<ChartVo>> listChartByPage(@RequestBody ChartQueryRequest chartQueryRequest);

    @Operation(summary = "分页获取当前用户创建的资源列表")
    @Parameters(value = {@Parameter(name = "uid", description = "用户id", in = ParameterIn.HEADER)})
    @PostMapping("/bi/my/list/page")
    BaseResponse<Page<ChartVo>> listMyChartByPage(@RequestHeader Long uid, @RequestBody ChartQueryRequest chartQueryRequest);

}
